

package cn.gz3c.uitest.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;

import com.huawei.hms.audioeditor.sdk.HuaweiAudioEditor;
import com.huawei.hms.audioeditor.sdk.asset.HAEAsset;
import com.huawei.hms.audioeditor.sdk.asset.HAEAsset.HAEAssetType;
import com.huawei.hms.audioeditor.sdk.lane.HAEAudioLane;
import com.huawei.hms.audioeditor.sdk.util.SmartLog;

public class CopyViewModel extends AndroidViewModel {
    private static final String a = "f";
    private EditPreviewViewModel editPreviewViewModel;

    public CopyViewModel(@NonNull Application var1) {
        super(var1);
    }

    private void a(boolean var1) {
        HAEAsset var2 = this.editPreviewViewModel.w();
        if (this.editPreviewViewModel.getHuaweiAudioEditor() != null && this.editPreviewViewModel.getHuaweiAudioEditor().getTimeLine() != null && var2 != null) {
            if (var2.getType() == HAEAssetType.AUDIO) {
                long var3 = this.editPreviewViewModel.G().getCurrentTime();
                HAEAudioLane var5 = com.huawei.hms.audioeditor.ui.p.b.b().a();
                HAEAsset var6;
                if ((var6 = this.editPreviewViewModel.G().copyAndInsertAsset(HAEAssetType.AUDIO, var2, var5.getIndex(), this.editPreviewViewModel.G().getCurrentTime(), var1)) != null) {
                    this.editPreviewViewModel.getHuaweiAudioEditor().seekTimeLine(var3, new HuaweiAudioEditor.SeekCallback() {
                        @Override
                        public void onSeekFinished() {
//                            var6.K();
//                            var6.d(var6.getUuid());
                        }
                    });
                }
            }
        }
    }

    public void setEditPreviewViewModel(EditPreviewViewModel editPreviewViewModel) {
        this.editPreviewViewModel = editPreviewViewModel;
    }

    public void a(int var1) {
        if (var1 == 1) {
            this.a(false);
        } else if (var1 == 2) {
            this.a(true);
        } else {
            SmartLog.e(a, "No choose copy type!");
        }

    }

}
